{extend name="default/template/base_index" /}


{block name="area_header"}

	<link type="text/css" rel="stylesheet" src="__CDN__/jquery-uploadify/3.2.1/uploadify.css" /
	>
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
			<!-- 带验证 form -->
			<form class="form-horizontal well validateForm">
				<input type="hidden" name="id" value="{$newsVO.id}"  />
				<fieldset>
					<legend>
						微信文本回复添加表单</legend>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">关键词</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" value="{$newsVO.keyword}"  name="keyword" id="inputtitle" placeholder="{:L('PLACEHOLDER_TITLE')}">
							<div class="help-block">(关键词)</div>
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">标题</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control" value="{$newsVO.title}"  name="title" id="title" placeholder="请输入标题" />
							<div class="help-block">(图文标题)</div>
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图片</label>
						<div class="col-md-10 col-lg-10">
							<!--<textarea rows="5" class="required form-control" name="picurl" id="description" placeholder="请输入图片链接"></textarea>
							<div class="help-block">(图文的图片链接)</div>-->
							<div class="controls">
								<input type="file" id="upload_picture">
								<input type="hidden" name="pictureid" id="cover_id" value="" />
								<input type="hidden" name="picurl" id="picurl" value="" />
								<div class="upload-img-box">
									<notempty name="$vo['picurl']">
								 			<img class="img-responsive thumbnail" src="{$vo.picurl}"/>
									{/notempty}
								</div>
							</div>
							<script type="text/javascript">
												//上传图片
											    /* 初始化上传插件  */
												$("#upload_picture").uploadify({
													'buttonClass' : 'btn btn-primary btn-sm',
											        "height"          : "100%",
											        "swf"             : "__CDN__/jquery-uploadify/3.2.1/uploadify.swf",
											        "fileObjName"     : "download",
											        "buttonText"      : "上传图片",
//											        "buttonImage"      : "上传图片",
											        "uploader"        : "{:url('File/uploadPicture',array('session_id'=>session_id()))}",
											        "width"           : 120,
											        'removeTimeout'	  : 1,
											        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
											        "onUploadSuccess" : uploadPicture
											    });
												function uploadPicture(file, data){
											    	var data = $.parseJSON(data);
											    	var src = '';
											        if(data.status){
											        	$("#cover_id").val(data.id);
											        	src = data.url || '__ROOT__' + data.path;
											        	$("#picurl").val(src);
											        	$("#cover_id").parent().find('.upload-img-box').html(
											        		'<img class="img-responsive thumbnail" src="' + src + '"/>'
											        	);
											        } else {											        	
														$.scojs_message(data.info , $.scojs_message.TYPE_OK);											        	
											        }
											    }
							</script>
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">描述</label>
						<div class="col-md-10 col-lg-10">
							<textarea rows="5" class="required form-control" name="description" id="description" placeholder="请输入描述">{$newsVO.description}</textarea>
							<div class="help-block">(图文描述)</div>
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图文跳转链接</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control" value="{$newsVO.url}" name="url" id="url" placeholder="请输入图文跳转链接"></textarea>
							<div class="help-block">(点击图文跳转的链接)</div>
						</div>
					</div>
					
					<div class="form-group">
						<label for="btns" class="col-md-2 col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="validateForm" class="ajax-post btn btn-primary" href="{:url(''.CONTROLLER_NAME.'/edit')}" autofocus="autofocus"><i class="fa fa-save"></i> {:L('BTN_SAVE')}</a>
							<a class="btn btn-default" href="{:url(''.CONTROLLER_NAME.'/index')}"><i class="fa fa-times-circle"></i> {:L('BTN_CANCEL')}</a>
						</div>
					</div>
				</fieldset>
			</form>
			<!-- form -->
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
{/block}

{block name="area_footer"}

{/block}